<template>
  <div class="content">
    <i class="iconfont icon-biaoqing" id="init" ref="icon" v-tap="{methods:back}"></i>
    <div class="wrapper">
      <input type="text" placeholder="秒杀好礼" @click="tap" />
      <i class="iconfont icon-sousuo" id="init" ref="icon"></i>
      <div class="cancel" ref="cancel" v-tap="{methods:close}">取消</div>
    </div>
    <div class="box_con" v-for="item in list" :key="item.pid" v-tap="{methods:detail,id:item.pid}">
      <img :src="item.pimg" alt />
      <h3>{{item.pname}}</h3>
      <b>
        ￥{{item.pprice}}
        <span>起</span>
      </b>
    </div>
  </div>
</template>

<script>
import * as api from "../api/getProlist";
export default {
  name: "searchcontent",
  data(){
      return {
          list:[],
      }
  },
  mounted(){
      document.getElementsByTagName("input")[0].value = this.$route.query.pname;
      api.getProdNameDel({ 'pname': this.$route.query.pname }).then(data => {
        this.list = data.data.result;
      });
  },
  methods:{
    tap(){
      this.$router.push("/search");
    },
    close() {
      this.$refs.cancel.style.display = "none";
      this.$refs.icon.setAttribute("id", "init");
      this.show = false;
      this.$router.go(-1);
    },
    back(){
      this.$router.push("/");
    },
    detail(id){
      this.$router.push('/ProdDetail?id='+id.id);
    }
  }
};
</script>

<style scoped>
.box_con{
    width: 45%;
    float: left;
    margin: 10px;
    text-align: center;
    overflow: hidden;
}
.box_con img{
    width: 100%;
    height: 400px;
}.search {
  padding: 5px 10px;
}
.icon-biaoqing{
  font-size:46px;
  float: left;
  line-height:75px;
  margin-right:10px;
}
.wrapper {
  height: 75px;
  border-bottom: solid 1px #000;
  line-height: 75px;
  position: relative;
  margin-left:40px;
}
.wrapper input {
  height: 50px;
  width: 50%;
  border: 0;
  margin-left: 20px;
}
.wrapper #init {
  font-size: 36px;
  line-height: 75px;
  float: right;
  margin-right: 20px;
}
.wrapper #change {
  font-size: 28px;
  line-height: 75px;
  float: left;
  margin-left: 10px;
  font-weight: bold;
  color: #615f5f;
}
.wrapper .cancel {
  font-size: 24px;
  position: absolute;
  right: 20px;
  top: 3px;
  display: none;
}


</style>